home *** CD-ROM | disk | FTP | other *** search
/ IRIX Base Documentation 2001 May / SGI IRIX Base Documentation 2001 May.iso / usr / share / catman / p_man / cat3 / librw / rw_hashmultimap.z / rw_hashmultimap
Encoding:
Text File  |  1998-10-30  |  20.8 KB  |  463 lines

  1.  
  2.  
  3.  
  4. rrrrwwww____hhhhaaaasssshhhhmmmmuuuullllttttiiiimmmmaaaapppp((((3333CCCC++++++++))))                                    rrrrwwww____hhhhaaaasssshhhhmmmmuuuullllttttiiiimmmmaaaapppp((((3333CCCC++++++++))))
  5.  
  6.  
  7.  
  8. NNNNaaaammmmeeee
  9.      rw_hashmultimap - Rogue Wave library class
  10.  
  11. SSSSyyyynnnnooooppppssssiiiissss
  12.               #include <rw/rwstl/hashmmap.h>
  13.           rw_hashmultimap<K,V,Hash,EQ> mmap;
  14.  
  15.  
  16.  
  17.  
  18. DDDDeeeessssccccrrrriiiippppttttiiiioooonnnn
  19.      Class rrrrwwww____hhhhaaaasssshhhhmmmmuuuullllttttiiiimmmmaaaapppp<<<<KKKK,,,,VVVV,,,,HHHHaaaasssshhhh,,,,EEEEQQQQ>>>> maintains a collection of mappings
  20.      between KKKK and VVVV, implemented as a hash table of ppppaaaaiiiirrrr<<<<ccccoooonnnnsssstttt KKKK,,,,VVVV>>>> in which
  21.      there may be many pairs with the same KKKK instance.  Since this is a vvvvaaaalllluuuueeee
  22.      based collection, objects are ccccooooppppiiiieeeedddd into and out of the collection.  As
  23.      with all classes that meet the ANSI aaaassssssssoooocccciiiiaaaattttiiiivvvveeee ccccoooonnnnttttaaaaiiiinnnneeeerrrr specification,
  24.      rrrrwwww____hhhhaaaasssshhhhmmmmaaaapppp provides for iterators that reference its elements.
  25.      Operations that alter the contents of rrrrwwww____hhhhaaaasssshhhhmmmmaaaapppp may invalidate other
  26.      iterators that reference the container.  Since the contents of rrrrwwww____hhhhaaaasssshhhhmmmmaaaapppp
  27.      are in pseudo-random order, the only iterator ranges that will usually
  28.      make sense are the results of calling eeeeqqqquuuuaaaallll____rrrraaaannnnggggeeee((((kkkkeeeeyyyy)))), and the entire
  29.      range from bbbbeeeeggggiiiinnnn(((()))) to eeeennnndddd(((()))).
  30.  
  31. PPPPeeeerrrrssssiiiisssstttteeeennnncccceeee
  32.      None
  33.  
  34. PPPPuuuubbbblllliiiicccc TTTTyyyyppppeeeeddddeeeeffffssss
  35.               typedef K                   key_type;
  36.           typedef Hash                key_hash;
  37.           typedef EQ                  key_equal;
  38.           typedef pair<K,V>           value_type; // or ... "const K"
  39.           typedef (unsigned)          size_type; //from rw_slist
  40.           typedef (int)               difference_type; // from rw_slist
  41.           typedef (value_type&)       reference;
  42.           typedef (const value_type&) const_reference; //from rw_slist
  43.  
  44.  
  45.      Iterators over rrrrwwww____hhhhaaaasssshhhhmmmmuuuullllttttiiiimmmmaaaapppp<<<<KKKK,,,,VVVV,,,,HHHHaaaasssshhhh,,,,EEEEQQQQ>>>> are forward iterators.
  46.  
  47.               typedef (scoped Iterator)      iterator;
  48.           typedef (scoped ConsIterator)  const_iterator;
  49.  
  50.  
  51.  
  52. PPPPuuuubbbblllliiiicccc CCCCoooonnnnssssttttrrrruuuuccccttttoooorrrrssss
  53.               rrrrwwww____hhhhaaaasssshhhhmmmmuuuullllttttiiiimmmmaaaapppp<<<<KKKK,,,,VVVV,,,,HHHHaaaasssshhhh,,,,EEEEQQQQ>>>>(size_type sz = 1024,
  54.                                        const Hash& h = Hash(),
  55.                                        const EQ& eq = EQ());
  56.  
  57.  
  58.      Construct an empty rrrrwwww____hhhhaaaasssshhhhmmmmuuuullllttttiiiimmmmaaaapppp<<<<KKKK,,,,VVVV,,,,HHHHaaaasssshhhh,,,,EEEEQQQQ>>>> with sssszzzz slots, using hhhh as
  59.      the hash object, and eeeeqqqq as the equality comparator.
  60.  
  61.  
  62.  
  63.                                                                         PPPPaaaaggggeeee 1111
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70. rrrrwwww____hhhhaaaasssshhhhmmmmuuuullllttttiiiimmmmaaaapppp((((3333CCCC++++++++))))                                    rrrrwwww____hhhhaaaasssshhhhmmmmuuuullllttttiiiimmmmaaaapppp((((3333CCCC++++++++))))
  71.  
  72.  
  73.  
  74.               rrrrwwww____hhhhaaaasssshhhhmmmmuuuullllttttiiiimmmmaaaapppp<<<<KKKK,,,,VVVV,,,,HHHHaaaasssshhhh,,,,EEEEQQQQ>>>>(const
  75.                                    rw_hashmultimap<K,V,Hash,EQ>& mmap);
  76.  
  77.  
  78.      Construct an rrrrwwww____hhhhaaaasssshhhhmmmmuuuullllttttiiiimmmmaaaapppp<<<<KKKK,,,,VVVV,,,,HHHHaaaasssshhhh,,,,EEEEQQQQ>>>> which is a copy of mmmmmmmmaaaapppp.  Each
  79.      element from mmmmmmmmaaaapppp will be copied into self.
  80.  
  81.               rrrrwwww____hhhhaaaasssshhhhmmmmuuuullllttttiiiimmmmaaaapppp<<<<KKKK,,,,VVVV,,,,HHHHaaaasssshhhh,,,,EEEEQQQQ>>>>(const_iterator first,
  82.                                        const_iterator bound
  83.                                        size_type sz=1024,
  84.                                        const Hash& h = Hash(),
  85.                                        const EQ& eq = EQ());
  86.  
  87.  
  88.      Construct an rrrrwwww____hhhhaaaasssshhhhmmmmuuuullllttttiiiimmmmaaaapppp<<<<KKKK,,,,VVVV,,,,HHHHaaaasssshhhh,,,,EEEEQQQQ>>>> with sssszzzz slots, using hhhh as the
  89.      hash object, and eeeeqqqq as the equality comparator, containing a copy of each
  90.      pair referenced by the range starting with ffffiiiirrrrsssstttt and bounded by bbbboooouuuunnnndddd.
  91.  
  92.               rrrrwwww____hhhhaaaasssshhhhmmmmuuuullllttttiiiimmmmaaaapppp<<<<KKKK,,,,VVVV,,,,HHHHaaaasssshhhh,,,,EEEEQQQQ>>>>(const value_type* first,
  93.                                        const value_type* bound
  94.                                        size_type sz=1024,
  95.                                        const Hash& h = Hash(),
  96.                                        const EQ& eq = EQ());
  97.  
  98.  
  99.      Construct an rrrrwwww____hhhhaaaasssshhhhmmmmuuuullllttttiiiimmmmaaaapppp<<<<KKKK,,,,VVVV,,,,HHHHaaaasssshhhh,,,,EEEEQQQQ>>>> with sssszzzz slots, using hhhh as the
  100.      hash object, and eeeeqqqq as the equality comparator, containing a copy of each
  101.      pair referenced by the range starting with ffffiiiirrrrsssstttt and bounded by bbbboooouuuunnnndddd.
  102.  
  103. PPPPuuuubbbblllliiiicccc DDDDeeeessssttttrrrruuuuccccttttoooorrrr
  104.               ~~~~rrrrwwww____hhhhaaaasssshhhhmmmmuuuullllttttiiiimmmmaaaapppp<<<<KKKK,,,,VVVV,,,,HHHHaaaasssshhhh,,,,EEEEQQQQ>>>>();
  105.  
  106.  
  107.      The destructor releases the memory used by the container's
  108.      implementation.
  109.  
  110. PPPPuuuubbbblllliiiicccc OOOOppppeeeerrrraaaattttoooorrrrssss
  111.               rw_hashmultimap<K,V,Hash,EQ>&
  112.           ooooppppeeeerrrraaaattttoooorrrr====(const rw_hashmultimap<K,V,Hash,EQ>& rhs);
  113.  
  114.  
  115.      Sets self to have the same capacity, HHHHaaaasssshhhh and EEEEQQQQ as rrrrhhhhssss, removes all
  116.      self's current contents, and replaces them with copies of the elements in
  117.      rrrrhhhhssss.
  118.  
  119.               bool
  120.           ooooppppeeeerrrraaaattttoooorrrr========(const rw_hashmultimap<K,V,Hash,EQ> & rhs) const;
  121.  
  122.  
  123.      Returns true if self and rrrrhhhhssss have the same number of elements, and for
  124.      each vvvvaaaalllluuuueeee____ttttyyyyppppeeee in self, there is exactly one corresponding vvvvaaaalllluuuueeee____ttttyyyyppppeeee in
  125.      rrrrhhhhssss that has a first part for which the EEEEQQQQ object in self returns true,
  126.  
  127.  
  128.  
  129.                                                                         PPPPaaaaggggeeee 2222
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136. rrrrwwww____hhhhaaaasssshhhhmmmmuuuullllttttiiiimmmmaaaapppp((((3333CCCC++++++++))))                                    rrrrwwww____hhhhaaaasssshhhhmmmmuuuullllttttiiiimmmmaaaapppp((((3333CCCC++++++++))))
  137.  
  138.  
  139.  
  140.      and a second part for which ooooppppeeeerrrraaaattttoooorrrr========(((()))) returns true.  The need to test
  141.      both parts, and ensure that the matches are one-to-one means that this
  142.      operator may be significantly slower than the method eeeeqqqquuuuaaaallll____bbbbyyyy____kkkkeeeeyyyyssss(((())))
  143.      described below.
  144.  
  145. AAAAcccccccceeeessssssssoooorrrrssss
  146.               iterator
  147.           bbbbeeeeggggiiiinnnn();
  148.  
  149.  
  150.      The iterator returned references the first item in self.  If self is
  151.      empty, the iterator is equal to eeeennnndddd(((()))).  Note that because items are
  152.      stored in pseudo-random order, this iterator might reference any item
  153.      that has been stored in self.
  154.  
  155.               const_iterator
  156.           bbbbeeeeggggiiiinnnn() const;
  157.  
  158.  
  159.      The iterator returned references the first item in self.  If self is
  160.      empty, the iterator is equal to eeeennnndddd(((()))).  Note that because items are
  161.      stored in pseudo-random order, this iterator might reference any item
  162.      that has been stored in self.
  163.  
  164.               iterator
  165.           eeeennnndddd();
  166.  
  167.  
  168.      The iterator returned marks the location "off the end" of self.  It may
  169.      not be dereferenced.
  170.  
  171.               const_iterator
  172.           eeeennnndddd() const;
  173.  
  174.  
  175.      The iterator returned marks the location "off the end" of self.  It may
  176.      not be dereferenced.
  177.  
  178.               pair<const_iterator, const_iterator>
  179.           eeeeqqqquuuuaaaallll____rrrraaaannnnggggeeee(const key_type key) const;
  180.  
  181.  
  182.      Returns ppppaaaaiiiirrrr<<<<ccccoooonnnnsssstttt____iiiitttteeeerrrraaaattttoooorrrr,,,,ccccoooonnnnsssstttt____iiiitttteeeerrrraaaattttoooorrrr>>>>((((lllloooowwwweeeerrrr____bbbboooouuuunnnndddd((((kkkkeeeeyyyy)))),,,,
  183.      uuuuppppppppeeeerrrr____bbbboooouuuunnnndddd((((kkkkeeeeyyyy)))))))).  Upper and lower bound have special meaning for hash-
  184.      based collections.  See discussion elsewhere.
  185.  
  186.               pair<iterator, iterator>
  187.           eeeeqqqquuuuaaaallll____rrrraaaannnnggggeeee(const key_type key);
  188.  
  189.  
  190.      Returns ppppaaaaiiiirrrr<<<<iiiitttteeeerrrraaaattttoooorrrr,,,,iiiitttteeeerrrraaaattttoooorrrr>>>>((((lllloooowwwweeeerrrr____bbbboooouuuunnnndddd((((kkkkeeeeyyyy)))),,,, uuuuppppppppeeeerrrr____bbbboooouuuunnnndddd((((kkkkeeeeyyyy)))))))).
  191.      Upper and lower bound have special meaning for hash-based collections.
  192.  
  193.  
  194.  
  195.                                                                         PPPPaaaaggggeeee 3333
  196.  
  197.  
  198.  
  199.  
  200.  
  201.  
  202. rrrrwwww____hhhhaaaasssshhhhmmmmuuuullllttttiiiimmmmaaaapppp((((3333CCCC++++++++))))                                    rrrrwwww____hhhhaaaasssshhhhmmmmuuuullllttttiiiimmmmaaaapppp((((3333CCCC++++++++))))
  203.  
  204.  
  205.  
  206.      See discussion elsewhere.
  207.  
  208.               const_iterator
  209.           lllloooowwwweeeerrrr____bbbboooouuuunnnndddd(const key_type& key) const;
  210.  
  211.  
  212.      Returns the lower bound of kkkkeeeeyyyy in self.  This has a special meaning for
  213.      hash-based collections.  See discussion elsewhere.
  214.  
  215.               iterator
  216.           lllloooowwwweeeerrrr____bbbboooouuuunnnndddd(const key_type& key);
  217.  
  218.  
  219.      Returns the lower bound of kkkkeeeeyyyy in self.  This has a special meaning for
  220.      hash-based collections.  See discussion elsewhere.
  221.  
  222.               const_iterator
  223.           uuuuppppppppeeeerrrr____bbbboooouuuunnnndddd(const key_type& key) const;
  224.  
  225.  
  226.      Returns the upper bound of kkkkeeeeyyyy in self.  This has a special meaning for
  227.      hash-based collections.  See discussion elsewhere.
  228.  
  229.               iterator
  230.           uuuuppppppppeeeerrrr____bbbboooouuuunnnndddd(const key_type& key);
  231.  
  232.  
  233.      Returns the upper bound of kkkkeeeeyyyy in self.  This has a special meaning for
  234.      hash-based collections.  See discussion elsewhere.
  235.  
  236. CCCCoooonnnnsssstttt PPPPuuuubbbblllliiiicccc MMMMeeeemmmmbbbbeeeerrrr FFFFuuuunnnnccccttttiiiioooonnnnssss
  237.               size_type
  238.           ccccaaaappppaaaacccciiiittttyyyy() const;
  239.  
  240.  
  241.      Returns the number of slots in the hash table that self uses.
  242.  
  243.               bool
  244.           eeeemmmmppppttttyyyy() const;
  245.  
  246.  
  247.      Returns ttttrrrruuuueeee if self is empty.
  248.  
  249.               float
  250.           ffffiiiillllllll____rrrraaaattttiiiioooo() const;
  251.  
  252.  
  253.      Returns the result of calculating ssssiiiizzzzeeee(((())))////ccccaaaappppaaaacccciiiittttyyyy(((()))).
  254.  
  255.               size_type
  256.           ssssiiiizzzzeeee() const;
  257.  
  258.  
  259.  
  260.  
  261.                                                                         PPPPaaaaggggeeee 4444
  262.  
  263.  
  264.  
  265.  
  266.  
  267.  
  268. rrrrwwww____hhhhaaaasssshhhhmmmmuuuullllttttiiiimmmmaaaapppp((((3333CCCC++++++++))))                                    rrrrwwww____hhhhaaaasssshhhhmmmmuuuullllttttiiiimmmmaaaapppp((((3333CCCC++++++++))))
  269.  
  270.  
  271.  
  272.      Returns the number of items currently held in self.
  273.  
  274. MMMMuuuuttttaaaattttoooorrrrssss
  275.               void
  276.           cccclllleeeeaaaarrrr();
  277.  
  278.  
  279.      A synonym for eeeerrrraaaasssseeee((((bbbbeeeeggggiiiinnnn(((()))),,,,eeeennnndddd(((())))))));;;;
  280.  
  281.               size_type
  282.           eeeerrrraaaasssseeee(const key_type& key);
  283.  
  284.  
  285.      Removes all pairs in self for which the first part is EEEEQQQQ to kkkkeeeeyyyy, and
  286.      returns the number of removed elements.
  287.  
  288.               iterator
  289.           eeeerrrraaaasssseeee(iterator iter);
  290.  
  291.  
  292.      Removes the element referenced by iiiitttteeeerrrr and returns an iterator
  293.      referencing the "next" element.  If iiiitttteeeerrrr does not reference an item in
  294.      self, the result is undefined.
  295.  
  296.               iterator
  297.           eeeerrrraaaasssseeee(iterator first, iterator bound);
  298.  
  299.  
  300.      Removes each element in the range which begins with ffffiiiirrrrsssstttt and is bound by
  301.      bbbboooouuuunnnndddd.  Returns an iterator referencing bbbboooouuuunnnndddd.  If ffffiiiirrrrsssstttt does not
  302.      reference an item in self (and if ffffiiiirrrrsssstttt and bbbboooouuuunnnndddd are not equal), the
  303.      effect is undefined.
  304.  
  305.               pair<iterator,bool>
  306.           iiiinnnnsssseeeerrrrtttt(const value_type& val);
  307.  
  308.  
  309.      Inserts the pair, vvvvaaaallll, and returns a pair with an iterator referencing
  310.      the new element and ttttrrrruuuueeee.
  311.  
  312.               size_type
  313.           iiiinnnnsssseeeerrrrtttt(iterator ignore, const value_type& val);
  314.  
  315.  
  316.      Inserts the pair, vvvvaaaallll, returning 1111.  Note that the first argument is
  317.      provided only for conformance with the ANSI aaaassssssssoooocccciiiiaaaattttiiiivvvveeee ccccoooonnnnttttaaaaiiiinnnneeeerrrr
  318.      specification, and is ignored by the method, since hash table look up can
  319.      be done in constant time.
  320.  
  321.               size_type
  322.           iiiinnnnsssseeeerrrrtttt(const value_type* first, const value_type* bound);
  323.  
  324.  
  325.  
  326.  
  327.                                                                         PPPPaaaaggggeeee 5555
  328.  
  329.  
  330.  
  331.  
  332.  
  333.  
  334. rrrrwwww____hhhhaaaasssshhhhmmmmuuuullllttttiiiimmmmaaaapppp((((3333CCCC++++++++))))                                    rrrrwwww____hhhhaaaasssshhhhmmmmuuuullllttttiiiimmmmaaaapppp((((3333CCCC++++++++))))
  335.  
  336.  
  337.  
  338.      For each element in the range beginning with ffffiiiirrrrsssstttt and bounded by bbbboooouuuunnnndddd,
  339.      the element is copied into self.  Returns the number of elements
  340.      inserted.
  341.  
  342.               size_type
  343.           iiiinnnnsssseeeerrrrtttt(const_iterator first, const_iterator bound);
  344.  
  345.  
  346.      For each element in the range beginning with ffffiiiirrrrsssstttt and bounded by bbbboooouuuunnnndddd,
  347.      the element is copied into self.  Returns the number of elements
  348.      inserted.
  349.  
  350.               void
  351.           sssswwwwaaaapppp(rw_hashmultimap<K,V,Hash,EQ>& other);
  352.  
  353.  
  354.      Exchanges the contents of self with ooootttthhhheeeerrrr including the HHHHaaaasssshhhh and EEEEQQQQ
  355.      objects.  This method does not copy or destroy any of the items exchanged
  356.      but exchanges the underlying hash tables.
  357.  
  358. SSSSppppeeeecccciiiiaaaallll MMMMeeeetttthhhhooooddddssss ffffoooorrrr MMMMuuuullllttttiiiimmmmaaaappppssss
  359.               size_type
  360.           ccccoooouuuunnnntttt(const key_type& key) const;
  361.  
  362.  
  363.      Returns the number of pairs in self which have kkkkeeeeyyyy EEEEQQQQ to their first
  364.      element.
  365.  
  366.               bool
  367.           eeeeqqqquuuuaaaallll____bbbbyyyy____kkkkeeeeyyyyssss(const rw_hashmultimap<K,V,Hash,EQ>& rhs) const;
  368.  
  369.  
  370.      Returns true if self and rrrrhhhhssss have the same size, and if for each distinct
  371.      kkkkeeeeyyyy____ttttyyyyppppeeee in self, self and rrrrhhhhssss have the same number of pairs with first
  372.      parts that test EEEEQQQQ to that instance.  Note that this method does not
  373.      compare the VVVV (second) part of the pair of the items, so it will run
  374.      slightly faster than ooooppppeeeerrrraaaattttoooorrrr========(((()))).
  375.  
  376.               const_iterator
  377.           ffffiiiinnnndddd(const key_type& key) const;
  378.  
  379.  
  380.      Returns a const_iterator referencing some pair with kkkkeeeeyyyy as its first
  381.      element, if such a pair is contained in self, else returns eeeennnndddd(((()))).
  382.  
  383.               iterator
  384.           ffffiiiinnnndddd(const key_type& key);
  385.  
  386.  
  387.      Returns an iterator referencing some pair with kkkkeeeeyyyy as its first element,
  388.      if such a pair is contained in self, else returns eeeennnndddd(((()))).
  389.  
  390.  
  391.  
  392.  
  393.                                                                         PPPPaaaaggggeeee 6666
  394.  
  395.  
  396.  
  397.  
  398.  
  399.  
  400. rrrrwwww____hhhhaaaasssshhhhmmmmuuuullllttttiiiimmmmaaaapppp((((3333CCCC++++++++))))                                    rrrrwwww____hhhhaaaasssshhhhmmmmuuuullllttttiiiimmmmaaaapppp((((3333CCCC++++++++))))
  401.  
  402.  
  403.  
  404.               void
  405.           rrrreeeessssiiiizzzzeeee(size_type sz);
  406.  
  407.  
  408.      Resizes self's hash table to have sssszzzz slots; and re-hashes all self's
  409.      elements into the new table.  Can be very expensive if self holds many
  410.      elements.
  411.  
  412.  
  413.  
  414.  
  415.  
  416.  
  417.  
  418.  
  419.  
  420.  
  421.  
  422.  
  423.  
  424.  
  425.  
  426.  
  427.  
  428.  
  429.  
  430.  
  431.  
  432.  
  433.  
  434.  
  435.  
  436.  
  437.  
  438.  
  439.  
  440.  
  441.  
  442.  
  443.  
  444.  
  445.  
  446.  
  447.  
  448.  
  449.  
  450.  
  451.  
  452.  
  453.  
  454.  
  455.  
  456.  
  457.  
  458.  
  459.                                                                         PPPPaaaaggggeeee 7777
  460.  
  461.  
  462.  
  463.